// storage.js

export const saveStorage = (key, value) => {
  try {
    const serializedValue = value;
    localStorage.setItem(key, serializedValue);
  } catch (error) {
    // 处理可能出现的错误，例如：localStorage不可用或存储限制
    console.error("Error saving to localStorage:", error);
  }
};

export const getStorage = (key) => {
  try {
    const value = localStorage.getItem(key);
    return value ? value : null;
  } catch (error) {
    // 处理可能出现的错误，例如：localStorage不可用或存储限制
    console.error("Error loading from localStorage:", error);
    return null;
  }
};

export const removeStorage = (key) => {
  localStorage.removeItem(key);
};
